package cn.ztydata.teachingsystem.heaven.web.wrapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
import java.util.Enumeration;

/**
 * Created by kazaff on 2014/12/9.
 */
public class HttpSessionProxy implements HttpSession{

    private final static Logger log = LoggerFactory.getLogger(HttpSessionProxy.class);

    private CustomSession targetSession = null;

    public HttpSessionProxy(CustomSession session){
        targetSession = session;
    }

    public void init(String sessionId){
        targetSession.init(sessionId);
    }

    @Override
    public Object getAttribute(String name){
        return targetSession.getAttribute(name);
    }

    @Override
    public Enumeration<String> getAttributeNames(){
        return targetSession.getAttributeNames();
    }

    @Override
    public String getId(){
        return targetSession.getId();
    }

    @Override
    public long getCreationTime(){
        return targetSession.getCreationTime();
    }

    @Override
    public int getMaxInactiveInterval(){
        return targetSession.getMaxInactiveInterval();
    }

    @Override
    public long getLastAccessedTime(){
        return targetSession.getLastAccessedTime();
    }

    @Override
    public ServletContext getServletContext(){
        return targetSession.getServletContext();
    }

    @Override
    public HttpSessionContext getSessionContext(){
        return targetSession.getSessionContext();
    }

    @Override
    public Object getValue(String name){
        return targetSession.getValue(name);
    }

    @Override
    public String[] getValueNames(){
        return targetSession.getValueNames();
    }

    @Override
    public void invalidate(){
        targetSession.invalidate();
    }

    @Override
    public boolean isNew(){
        return targetSession.isNew();
    }

    @Override
    public void putValue(String name, Object value){
        targetSession.putValue(name, value);
    }

    @Override
    public void setAttribute(String name, Object value){
        targetSession.setAttribute(name, value);
    }

    @Override
    public void removeValue(String name){
        targetSession.removeValue(name);
    }

    @Override
    public void removeAttribute(String name){
        targetSession.removeAttribute(name);
    }

    @Override
    public void setMaxInactiveInterval(int internal){
        targetSession.setMaxInactiveInterval(internal);
    }
}
